package com.menghao.sso.server.config;

import com.menghao.sso.server.registry.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>服务端自配置类<br>
 *
 * @author menghao.
 * @version 2017/11/17.
 */
@Configuration
public class SsoServerAutoConfiguration {
    @Bean
    @ConditionalOnProperty(prefix = "menghao.sso.server", name = "ticketCache", havingValue = "default")
    public TicketRegistry defaultRegistry() {
        return new DefaultTicketRegistry();
    }

    @Bean
    public ExpirationPolicy expirationPolicy() {
        return new TimeoutExpirationPolicy(1000 * 60 * 60);
    }
}
